-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
856 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env node | ||
|
||
const path = require('path'); | ||
|
||
require('yargs') | ||
.scriptName('ima') | ||
.usage('Usage: $0 <command>') | ||
.commandDir(path.resolve(__dirname, '../scripts')) | ||
.demandCommand(1, 'You need to run at least one command to move on') | ||
.help() | ||
.wrap(null).argv; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"name": "@ima/cli", | ||
"version": "17.10.0", | ||
"description": "IMA.js CLI tool to build, develop and work with IMA.js applications.", | ||
"keywords": [ | ||
"IMA", | ||
"IMA.js", | ||
"Isomorphic", | ||
"Javascript" | ||
], | ||
"bin": { | ||
"ima": "./bin/ima.js" | ||
}, | ||
"author": "Miroslav Jancarik <miroslav.jancarik@firma.seznam.cz>", | ||
"contributors": [], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/seznam/ima.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/seznam/ima/issues" | ||
}, | ||
"publishConfig": { | ||
"registry": "https://registry.npmjs.org/", | ||
"access": "public" | ||
}, | ||
"license": "MIT", | ||
"devDependencies": { | ||
"chalk": "^4.1.1", | ||
"yargs": "^17.0.1" | ||
}, | ||
"dependencies": { | ||
"webpack": "^5.38.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
const path = require('path'); | ||
const webpack = require('webpack'); | ||
|
||
async function build(args) { | ||
const compiler = webpack({ | ||
mode: 'production', | ||
entry: path.resolve(args.cwd, 'test/index.js') | ||
}); | ||
|
||
compiler.run((err, stats) => { | ||
if (!err) { | ||
const out = stats.toString({ | ||
assets: true, | ||
cached: false, | ||
children: false, | ||
chunks: false, | ||
chunkModules: false, | ||
colors: true, | ||
hash: true, | ||
modules: false, | ||
reasons: false, | ||
source: false, | ||
timings: true, | ||
version: true | ||
}); | ||
|
||
console.log(out); | ||
} else { | ||
console.error(err); | ||
} | ||
}); | ||
} | ||
|
||
const buildCommand = { | ||
command: 'build', | ||
desc: 'Build an application for production', | ||
handler: async yargs => { | ||
await build({ | ||
yargs: yargs, | ||
cwd: process.cwd() | ||
}); | ||
} | ||
}; | ||
|
||
module.exports = buildCommand; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
const path = require('path'); | ||
const webpack = require('webpack'); | ||
|
||
async function dev(args) { | ||
const compiler = webpack({ | ||
mode: 'production', | ||
entry: path.resolve(args.cwd, 'test/index.js') | ||
}); | ||
|
||
compiler.watch({}, (err, stats) => { | ||
if (!err) { | ||
const out = stats.toString({ | ||
assets: true, | ||
cached: false, | ||
children: false, | ||
chunks: false, | ||
chunkModules: false, | ||
colors: true, | ||
hash: true, | ||
modules: false, | ||
reasons: false, | ||
source: false, | ||
timings: true, | ||
version: true | ||
}); | ||
|
||
console.log(out); | ||
} else { | ||
console.error(err); | ||
} | ||
}); | ||
} | ||
|
||
const devCommand = { | ||
command: 'dev', | ||
desc: 'Run application in development mode', | ||
builder: { | ||
'legacy-compat-mode': { | ||
desc: 'Runs application in ES5 compatible format' | ||
} | ||
}, | ||
handler: async yargs => { | ||
await dev({ | ||
yargs: yargs, | ||
cwd: process.cwd() | ||
}); | ||
} | ||
}; | ||
|
||
module.exports = devCommand; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const start = { | ||
command: 'start', | ||
desc: 'Run application in production', | ||
builder: { | ||
'legacy-compat-mode': { | ||
desc: 'Runs application in ES5 compatible format' | ||
} | ||
}, | ||
handler: yargs => { | ||
console.log(yargs); | ||
} | ||
}; | ||
|
||
module.exports = start; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
function test() { | ||
console.log('Hi!'); | ||
} | ||
|
||
module.exports = { test }; |
Empty file.