create-evergreen-app
Advanced tools
Comparing version 0.4.0 to 0.4.1
{ | ||
"name": "create-evergreen-app", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "Create an evergreen web application with no build configuration", | ||
@@ -20,2 +20,22 @@ "license": "MIT", | ||
}, | ||
"files": [ | ||
".browserslistrc", | ||
".editorconfig", | ||
".eslintrc", | ||
".gitignore", | ||
".gitattributes", | ||
"yarn.lock", | ||
"package-lock.json", | ||
"babel.config.js", | ||
"karma-test-shim.js", | ||
"karma.conf.js", | ||
"lws.config.js", | ||
"postcss.config.js", | ||
"README.md", | ||
"webpack.config.common.js", | ||
"webpack.config.develop.js", | ||
"webpack.config.prod.js", | ||
"src/", | ||
"tasks/" | ||
], | ||
"scripts": { | ||
@@ -39,3 +59,2 @@ "build": "rimraf ./public && webpack --config ./webpack.config.prod.js --progress", | ||
"babel-plugin-transform-builtin-classes": "^0.6.1", | ||
"cross-spawn": "^6.0.5", | ||
"css-loader": "^1.0.0", | ||
@@ -48,3 +67,2 @@ "css-to-string-loader": "^0.1.3", | ||
"file-loader": "^2.0.0", | ||
"fs-extra": "^7.0.1", | ||
"html-webpack-plugin": "^3.2.0", | ||
@@ -51,0 +69,0 @@ "istanbul-instrumenter-loader": "^3.0.1", |
@@ -41,3 +41,3 @@ # create-evergreen-app | ||
# 1) Create new evergreen app | ||
$ npx -D create-evergreen-app my-app | ||
$ npx create-evergreen-app my-app | ||
@@ -44,0 +44,0 @@ # 2) Change Directory |
#!/usr/bin/env node | ||
/* eslint no-console: 0 */ | ||
const spawn = require('cross-spawn'); | ||
// THIS SCRIPT SHOULD ONLY USE NATIVE NODE.JS APIs, NO PACKAGES FROM NPM ALLOWED | ||
const copyFolder = require('./copy-folder'); | ||
const fs = require('fs'); | ||
const os = require('os'); | ||
const path = require('path'); | ||
const fs = require('fs-extra'); | ||
const os = require('os'); | ||
const { spawn } = require('child_process'); | ||
@@ -16,3 +18,3 @@ let TARGET_DIR; | ||
// Check target application directory/name is included in args | ||
// remove directory if present, create new target directory | ||
// warn if directory is present, else create new target directory | ||
const checkTargetDir = async appDir => { | ||
@@ -26,9 +28,13 @@ if (!appDir) { | ||
const targetExists = await fs.pathExists(appDir); | ||
const targetExists = await fs.existsSync(appDir); | ||
if (targetExists) { | ||
// should we warn about this first? | ||
await fs.remove(appDir); | ||
console.error( | ||
`${appDir} already exists, existing project detected? Delete ${appDir} to try again or run from a different directory.` | ||
); | ||
process.exit(1); // eslint-disable-line no-process-exit | ||
} | ||
await fs.ensureDir(appDir); | ||
await fs.mkdirSync(appDir); | ||
return appDir; | ||
@@ -40,3 +46,3 @@ }; | ||
return new Promise((resolve, reject) => { | ||
const command = 'npm'; | ||
const command = os.platform() === 'win32' ? 'npm.cmd' : 'npm'; | ||
const args = ['install', '--save', '--save-exact', '--loglevel', 'error']; | ||
@@ -76,10 +82,9 @@ const child = spawn(command, args, { stdio: 'inherit' }); | ||
// Copy template files to target | ||
// Copy root and src files to target directory | ||
const srcInit = async () => { | ||
const copyDirs = [ | ||
'src', | ||
const rootFiles = [ | ||
'.browserslistrc', | ||
'.editorconfig', | ||
'.eslintrc', | ||
'.gitignore', | ||
// '.gitignore', | ||
'.gitattributes', | ||
@@ -99,15 +104,24 @@ 'yarn.lock', | ||
const sourceFiles = [ | ||
'src' | ||
]; | ||
return await Promise.all( | ||
copyDirs.map(async directory => { | ||
const initDir = path.join(__dirname, '..', directory); | ||
rootFiles.map(async fileName => { | ||
const resolvedFilePath = path.join(__dirname, '..', fileName); | ||
if (await fs.existsSync(initDir)) { | ||
return await fs.copySync( | ||
initDir, | ||
path.join(TARGET_DIR, directory) | ||
if (await fs.existsSync(resolvedFilePath)) { | ||
return await fs.copyFileSync( | ||
resolvedFilePath, | ||
path.join(TARGET_DIR, fileName) | ||
); | ||
} else { | ||
console.error("Directory doesn't exist! :" + initDir); | ||
console.error(`File doesn't exist! : ${resolvedFilePath}`); | ||
process.exit(1); // eslint-disable-line no-process-exit | ||
} | ||
}), | ||
sourceFiles.map(async directory => { | ||
const resolvedDirectoryPath = path.join(__dirname, '..', directory); | ||
await copyFolder(resolvedDirectoryPath, TARGET_DIR); | ||
}) | ||
@@ -114,0 +128,0 @@ ); |
Sorry, the diff of this file is not supported yet
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
1805328
34
14891
31
5
3