Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote Templates #329

Merged
merged 54 commits into from
Sep 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
71a6b6c
install `gittar`
lukeed Aug 19, 2017
d4ff638
remove flags: css,sass,less,dest,type
lukeed Aug 19, 2017
6c3c3aa
purge *css flag-related stuffs
lukeed Aug 19, 2017
b7f4cdc
extract yarn-vs-npm logic before printing
lukeed Aug 19, 2017
427b22e
replace ansi-codes with `chalk.green`
lukeed Aug 19, 2017
8ab7688
extract `pkgFile` path
lukeed Aug 19, 2017
6b878d4
use `argv.name` within pkg & manifest (Closes #326)
lukeed Aug 20, 2017
86a4f3b
extract an `error` helper
lukeed Aug 20, 2017
1ee0dfc
uninstall `recursive-copy`
lukeed Aug 20, 2017
5e4fdb0
extract `isDir` helper
lukeed Aug 20, 2017
a23765e
replace `copy` with `gittar.extract` - with filter
lukeed Aug 20, 2017
172ff54
move `target` + `exists` + `force` logic first;
lukeed Aug 20, 2017
f04532f
use `argv.dest` for final instructions
lukeed Aug 20, 2017
4dc79c0
fix typo
lukeed Aug 20, 2017
8daf606
export `setup` functions directly
lukeed Aug 20, 2017
eccca4f
remove debug-type stdout from `initGit`
lukeed Aug 20, 2017
15f1b6b
move common helpers to `util` file;
lukeed Aug 20, 2017
45b28c2
move `commandExists` —> `util.hasCommand`;
lukeed Aug 20, 2017
ce8d316
check if `yarn` bin exists on flag parsing;
lukeed Aug 20, 2017
60e4830
consolidate `setup.pkgScripts` function
lukeed Aug 20, 2017
34379f5
do not write a `gitignore` file
lukeed Aug 20, 2017
8dc0583
minor cleanup, warn if no `git` binary found
lukeed Aug 20, 2017
da46a8b
oops, fix regex tester
lukeed Aug 20, 2017
1e18c1a
don’t assume exit within `util.error`
lukeed Aug 20, 2017
c443554
use `warn` within watch command
lukeed Aug 20, 2017
39091a7
use `util.isDir` within serve command
lukeed Aug 20, 2017
8af1c30
remove `init` command publicly
lukeed Aug 20, 2017
dfec01b
Merge `master` into `templates`
lukeed Aug 20, 2017
c3430c7
alias “official” preact-cli templates by name
lukeed Aug 21, 2017
54b93ae
simplify `install` — install template deps
lukeed Aug 21, 2017
2f71fd3
move `trimLeft` —> `util.trim`
lukeed Aug 21, 2017
a18f968
remove `initialize` from setup;
lukeed Aug 21, 2017
2fd9522
simplify package-related `create`
lukeed Aug 21, 2017
6e1509f
only extract `/template/` filepaths
lukeed Aug 21, 2017
e9463b8
add extra TODO note
lukeed Aug 21, 2017
92fec7a
define `done` handler before export
lukeed Aug 22, 2017
6d0493b
update `test/subjects` names
lukeed Aug 22, 2017
32acd00
[MAJOR] tests refactor
lukeed Aug 23, 2017
1fb1133
move `serve.snapshot` —>`images/serve`
lukeed Aug 23, 2017
771f43c
add `deprecated` notice on `build.snapshot` file
lukeed Aug 23, 2017
1a994b7
remove unused `exists` helper
lukeed Aug 23, 2017
d7f748a
Merge branch 'master' into templates
reznord Aug 23, 2017
ca3b235
Fix tests/image/create.js test error
reznord Aug 23, 2017
85dfe85
Revert "Fix tests/image/create.js test error"
lukeed Aug 23, 2017
fb8f273
[Travis] only build `master` branch
lukeed Aug 23, 2017
b3380e0
remove `commands/init` file
lukeed Aug 23, 2017
f8f7ec4
add console statement for debug
lukeed Aug 23, 2017
1880a38
remove `dependency-install-loader`
lukeed Aug 26, 2017
bc7af44
update scripts path
lukeed Aug 26, 2017
0ed79d1
exit early if run `build` w/o installing deps;
lukeed Aug 26, 2017
faa8cad
always install deps for build subjects
lukeed Aug 26, 2017
741774e
remove `SKIP_INSTALL` global for Travis (temp)
lukeed Aug 26, 2017
7c1ad41
assume any template without `/` is official lookup
lukeed Sep 3, 2017
e7ee7f7
update tests, remove `full` alias
lukeed Sep 3, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ node_js:
- 6
- 8

branches:
only:
- master

cache:
npm: true
directories:
Expand All @@ -18,7 +22,8 @@ cache:

before_script:
- export LIGHTHOUSE_CHROMIUM_PATH=`which google-chrome-stable`
- if [ "$TRAVIS_BRANCH" = "master" ]; then export WITH_INSTALL=true; export WITH_LOG=true; fi
# - if [ "$TRAVIS_BRANCH" = "master" ]; then export SKIP_INSTALL=true; export WITH_LOG=true; fi
- if [ "$TRAVIS_BRANCH" = "master" ]; then export WITH_LOG=true; fi

script:
- npm run lint
Expand Down
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,6 @@ $ preact init
$ preact create

--name Directory and package name for the new app.
--dest Directory to create the app within. [default: <name>]
--type A project template to start from.
[Options: "full", "root", "simple", "empty"] [default: "full"]
--less Pre-install LESS support. [boolean] [default: false]
--sass Pre-install SASS/SCSS support. [boolean] [default: false]
--stylus Pre-install STYLUS support. [boolean] [default: false]
--git Initialize version control using git. [boolean] [default: false]
--no-install Disables installing of dependencies. [boolean] [default: false]
--yarn Installs dependencies with yarn. [boolean] [default: false]
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"prepublish": "npm run -s build",
"dev": "babel-node src",
"lint": "eslint src tests",
"pretest": "npm run -s build && rimraf ./tests/output",
"pretest": "npm run -s build && rimraf tests/output",
"test": "jest",
"posttest": "rimraf ./tests/output",
"posttest": "rimraf tests/output",
"postinstall": "node -p 'require(\"./check.js\")()'",
"test:build": "babel-node src build --cwd examples/root",
"test:serve": "npm run -s test:build && babel-node src serve --port 3000 --cwd examples/root",
Expand Down Expand Up @@ -90,7 +90,6 @@
"eslint-plugin-react": "^7.0.1",
"html-looks-like": "^1.0.2",
"jest": "^20.0.4",
"lodash": "^4.17.4",
"ncp": "^2.0.0",
"uuid": "^3.0.1"
},
Expand Down Expand Up @@ -121,6 +120,7 @@
"file-loader": "^0.11.1",
"fs.promised": "^3.0.0",
"get-port": "^3.1.0",
"gittar": "^0.1.0",
"glob": "^7.1.2",
"html-webpack-exclude-assets-plugin": "0.0.5",
"html-webpack-plugin": "^2.28.0",
Expand All @@ -131,6 +131,7 @@
"less": "^2.7.2",
"less-loader": "^4.0.3",
"loader-utils": "^1.1.0",
"log-symbols": "^2.0.0",
"minimatch": "^3.0.3",
"mkdirp": "^0.5.1",
"offline-plugin": "^4.6.2",
Expand All @@ -144,7 +145,6 @@
"progress-bar-webpack-plugin": "^1.9.3",
"promise-polyfill": "^6.0.2",
"raw-loader": "^0.5.1",
"recursive-copy": "^2.0.6",
"require-relative": "^0.8.7",
"rimraf": "^2.6.1",
"script-ext-html-webpack-plugin": "^1.8.0",
Expand Down
12 changes: 10 additions & 2 deletions src/commands/build.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { resolve } from 'path';
import rimraf from 'rimraf';
import { resolve } from 'path';
import { isDir, error } from '../util';
import asyncCommand from '../lib/async-command';
import runWebpack, { showStats, writeJsonStats } from '../lib/webpack/run-webpack';

Expand Down Expand Up @@ -48,8 +49,15 @@ export default asyncCommand({
},

async handler(argv) {
let cwd = argv.cwd ? resolve(argv.cwd) : process.cwd();
let modules = resolve(cwd, 'node_modules');

if (!isDir(modules)) {
return error('No `node_modules` found! Please run `npm install` before continuing.', 1);
}

if (argv.clean) {
let dest = resolve(argv.cwd || process.cwd(), argv.dest || 'build');
let dest = resolve(cwd, argv.dest || 'build');
await Promise.promisify(rimraf)(dest);
}

Expand Down
Loading