fix: creators
This commit is contained in:
parent
675aaadaed
commit
c1eee58a41
|
@ -1,10 +1,10 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const D = require('@flecks/core/build/debug');
|
||||
const {processCode} = require('@flecks/core/server');
|
||||
const {Command} = require('commander');
|
||||
|
||||
const Build = require('./build');
|
||||
const {processCode} = require('./commands');
|
||||
|
||||
const debug = D('@flecks/build/build/cli');
|
||||
const debugSilly = debug.extend('silly');
|
||||
|
|
|
@ -2,6 +2,7 @@ const {spawn} = require('child_process');
|
|||
const {join, normalize} = require('path');
|
||||
|
||||
const D = require('@flecks/core/build/debug');
|
||||
const {processCode, spawnWith} = require('@flecks/core/server');
|
||||
const {Argument, Option, program} = require('commander');
|
||||
const {glob} = require('glob');
|
||||
const rimraf = require('rimraf');
|
||||
|
@ -33,7 +34,7 @@ exports.commands = (program, flecks) => {
|
|||
args.push(packageManager, ['install', fleck]);
|
||||
}
|
||||
args.push({stdio: 'inherit'});
|
||||
await exports.processCode(spawn(...args));
|
||||
await processCode(spawn(...args));
|
||||
await addFleckToYml(fleck);
|
||||
},
|
||||
},
|
||||
|
@ -85,7 +86,7 @@ exports.commands = (program, flecks) => {
|
|||
'--mode', (production && !hot) ? 'production' : 'development',
|
||||
...((watch || hot) ? ['--watch'] : []),
|
||||
];
|
||||
return exports.spawnWith(
|
||||
return spawnWith(
|
||||
cmd,
|
||||
{
|
||||
env: {
|
||||
|
@ -117,7 +118,7 @@ exports.commands = (program, flecks) => {
|
|||
'.',
|
||||
];
|
||||
promises.push(new Promise((resolve, reject) => {
|
||||
const child = exports.spawnWith(
|
||||
const child = spawnWith(
|
||||
cmd,
|
||||
{
|
||||
cwd,
|
||||
|
@ -156,28 +157,6 @@ exports.commands = (program, flecks) => {
|
|||
return commands;
|
||||
};
|
||||
|
||||
exports.processCode = (child) => new Promise((resolve, reject) => {
|
||||
child.on('error', reject);
|
||||
child.on('exit', (code) => {
|
||||
child.off('error', reject);
|
||||
resolve(code);
|
||||
});
|
||||
});
|
||||
|
||||
exports.spawnWith = (cmd, opts = {}) => {
|
||||
debug("spawning: '%s'", cmd.join(' '));
|
||||
debugSilly('with options: %O', opts);
|
||||
const child = spawn(cmd[0], cmd.slice(1), {
|
||||
stdio: 'inherit',
|
||||
...opts,
|
||||
env: {
|
||||
...process.env,
|
||||
...opts.env,
|
||||
},
|
||||
});
|
||||
return child;
|
||||
};
|
||||
|
||||
exports.Argument = Argument;
|
||||
exports.Option = Option;
|
||||
exports.program = program;
|
||||
|
|
|
@ -10,6 +10,7 @@ const {
|
|||
|
||||
exports.hooks = {
|
||||
'@flecks/build.extensions': () => ['.mjs', '.js', '.json', '.wasm'],
|
||||
'@flecks/build.commands': commands,
|
||||
'@flecks/build.config': async (target, config, env, argv, flecks) => {
|
||||
if (flecks.get('@flecks/build.profile').includes(target)) {
|
||||
config.plugins.push(
|
||||
|
@ -45,7 +46,6 @@ exports.hooks = {
|
|||
*/
|
||||
'fleck.webpack.config.js',
|
||||
],
|
||||
'@flecks/build.commands': commands,
|
||||
'@flecks/core.config': () => ({
|
||||
/**
|
||||
* The package manager used for tasks.
|
||||
|
|
|
@ -1,3 +1,32 @@
|
|||
const {spawn} = require('child_process');
|
||||
|
||||
export {glob} from 'glob';
|
||||
|
||||
const D = require('../../build/debug');
|
||||
|
||||
const debug = D('@flecks/core/server');
|
||||
const debugSilly = debug.extend('silly');
|
||||
|
||||
export {JsonStream, transform} from '../../build/stream';
|
||||
|
||||
export const processCode = (child) => new Promise((resolve, reject) => {
|
||||
child.on('error', reject);
|
||||
child.on('exit', (code) => {
|
||||
child.off('error', reject);
|
||||
resolve(code);
|
||||
});
|
||||
});
|
||||
|
||||
export const spawnWith = (cmd, opts = {}) => {
|
||||
debug("spawning: '%s'", cmd.join(' '));
|
||||
debugSilly('with options: %O', opts);
|
||||
const child = spawn(cmd[0], cmd.slice(1), {
|
||||
stdio: 'inherit',
|
||||
...opts,
|
||||
env: {
|
||||
...process.env,
|
||||
...opts.env,
|
||||
},
|
||||
});
|
||||
return child;
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const {processCode, spawnWith} = require('@flecks/build/build/commands');
|
||||
const {processCode, spawnWith} = require('@flecks/core/server');
|
||||
|
||||
module.exports = async (packageManager, cwd) => {
|
||||
const code = await processCode(spawnWith([packageManager, 'install'], {cwd}));
|
||||
|
|
|
@ -3,11 +3,8 @@
|
|||
const {join} = require('path');
|
||||
|
||||
const {program} = require('@flecks/build/build/commands');
|
||||
const {
|
||||
dumpYml,
|
||||
loadYml,
|
||||
transform,
|
||||
} = require('@flecks/core/server');
|
||||
const {dumpYml, loadYml} = require('@flecks/build/server');
|
||||
const {transform} = require('@flecks/core/server');
|
||||
const validate = require('validate-npm-package-name');
|
||||
|
||||
const build = require('./build');
|
||||
|
|
|
@ -24,12 +24,12 @@
|
|||
"template"
|
||||
],
|
||||
"dependencies": {
|
||||
"@flecks/build": "^3.0.0",
|
||||
"@flecks/core": "^3.0.0",
|
||||
"minimatch": "^5.0.1",
|
||||
"validate-npm-package-name": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@flecks/build": "^3.0.0",
|
||||
"@flecks/fleck": "^3.0.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
'@flecks/build': {}
|
||||
'@flecks/core': {}
|
||||
'@flecks/server': {}
|
||||
|
|
|
@ -23,11 +23,11 @@
|
|||
"template"
|
||||
],
|
||||
"dependencies": {
|
||||
"@flecks/build": "^3.0.0",
|
||||
"@flecks/core": "^3.0.0",
|
||||
"@flecks/create-app": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@flecks/build": "^3.0.0",
|
||||
"@flecks/fleck": "^3.0.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@ const {stat, unlink} = require('fs/promises');
|
|||
const {join} = require('path');
|
||||
|
||||
const Build = require('@flecks/build/build/build');
|
||||
const {spawnWith} = require('@flecks/build/build/commands');
|
||||
const {regexFromExtensions} = require('@flecks/build/server');
|
||||
const {spawnWith} = require('@flecks/core/server');
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||
|
||||
const {
|
||||
|
|
Loading…
Reference in New Issue
Block a user