bevry / base Goto Github PK
View Code? Open in Web Editor NEWBase files for new projects
License: Other
Base files for new projects
License: Other
Currently I keep them in my dotfiles repo:
https://github.com/balupton/dotfiles/blob/master/.jshintrc
https://github.com/balupton/dotfiles/blob/master/coffeelint.json
Perhaps they should be here as well? With this being the source of truth?
This includes package.json badges
Any ideas @RobLoach
Seems it is preferred: https://houndci.com/configuration#coffeescript
Not sure if that is true though.
NPM scripts are pretty powerful, so perhaps we can just use them:
{
"scripts": {
"clean": "rimraf es2015 yuidoc",
"setup": "npm install",
"setup:build": "npm install --save-dev babel-cli babel-preset-es2015 eslint flow-bin rimraf yuidocjs && flow init",
"compile": "npm run compile:es2015",
"compile:es2015": "babel ./esnext --out-dir ./es2015 --presets es2015",
"meta": "npm run meta:yuidoc && npm run meta:projectz",
"meta:yuidoc": "yuidoc ./esnext -o yuidoc --syntaxtype js -e .js",
"meta:projectz": "./bin/projectz compile",
"prepare": "npm run clean && npm run compile && npm run test && npm run meta",
"release": "npm run prepare && npm run release:tag && npm run release:push",
"release:tag": "git tag v$npm_package_version -a",
"release:push": "git push origin master && git push origin --tags",
"pretest": "npm run test:eslint && npm run test:flow",
"test:eslint": "eslint ./esnext",
"test:flow": "flow check",
"test": "node --harmony ./es2015/test/index.js"
}
}
Problem is directory names and technologies are inside the scripts, rather than nakeConfiguration
but whatever.
I've made a gist that contains an extra generic method which callsnpm run-script with the calling task name as the script name.
generic method:
https://gist.github.com/pflannery/7182430#file-npm-run-script-cake-example-L57-L61
example usage:...(I find this really useful for debugging docpad instances)
https://gist.github.com/pflannery/7182430#file-npm-run-script-cake-example-L148-L151
I made a slight change to pass the calling task's scope to each action
https://gist.github.com/pflannery/7182430#file-npm-run-script-cake-example-L171
It would be nice to introduce a concept of editions for packages that include multiple targets. Something like:
{
"editions": {
"source": {
"directory": "src",
"entry": "src/lib/index.js"
},
"esnext": {
"directory": "esnext",
"entry": "esnext/lib/index.js",
"command": "babel src --out-dir esnext --presets es2015 --plugins syntax-flow transform-flow-strip-types"
},
"es2015": {
"directory": "es2015",
"entry": "es2015/lib/index.js",
"command": "babel src --out-dir es2015 --presets es2015 --plugins syntax-flow"
},
"prefer": "esnext",
"fallback": "es2015"
},
"esnext": {
"sourceDirectory": "esnext",
"compiledDirectory": "es5",
"guardianEntry": "esnextguardian.js",
"mainEntryRelative": "lib/index.js",
"testEntryRelative": "test/index.js"
}
}
Which using something like the following inside projectz:
// Babel
if ( opts.esnext ) {
const sourceDirectoryPath = `${opts.name}/${opts.esnext.sourceDirectory}`
const compiledDirectoryPath = `${opts.name}/${opts.esnext.compiledDirectory}`
const sourceEntryPath = `${sourceDirectoryPath}/${opts.esnext.mainEntryRelative}`
const compiledEntryPath = `${compiledDirectoryPath}/${opts.esnext.mainEntryRelative}`
const guardianEntryPath = `${opts.name}/${opts.esnext.guardianEntry}`
const guardianLink = projectzUtil.getLink({text: 'ESNextGuardian', url: 'https://www.npmjs.com/package/esnextguardian', title: `Loads ES6+ files if the user's environment supports it, otherwise gracefully fallback to ES5 files.`})
const polyfillLink = projectzUtil.getLink({text: `Babel's Polyfill`, url: 'https://babeljs.io/docs/usage/polyfill/', title: 'A polyfill by the Babel project that emulates missing ECMAScript environment features'})
const babelLink = projectzUtil.getLink({text: 'Babel', url: 'https://babeljs.io', title: 'The compiler for writing next generation JavaScript'})
const esLink = projectzUtil.getLink({text: 'latest ECMAScript standards', url: 'https://babeljs.io/docs/learn-es2015/'})
parts.push([
`<h3>ESNext</h3>`,
`<p>This project is written using the ${esLink} and compiled using ${babelLink}.<br/>`,
`<ul><li>The source code is at <code>${sourceDirectoryPath}</code> and entry is at <code>${sourceEntryPath}</code></li>`,
`<li>The compiled code is at <code>${compiledDirectoryPath}</code> and entry is at <code>${compiledEntryPath}</code></li>`,
`<li>The default entry uses ${guardianLink} and is at <code>${guardianEntryPath}</code></li></ul>`,
`Older ECMAScript environments may need ${polyfillLink} or something else.</p>`
].join('\n'))
}
Will generate a README entry like:
ESNext
This project is written using the latest ECMAScript standards and compiled using Babel.
Older ECMAScript environments may need Babel's Polyfill or something else.
- The source code is at
projectz/esnext
and entry is atprojectz/esnext/lib/index.js
- The compiled code is at
projectz/es5
and entry is atprojectz/es5/lib/index.js
- The default entry uses ESNextGuardian and is at
projectz/esnextguardian.js
these two are limiters though:
initial work happening over at https://github.com/bevry/typechecker/tree/feature/update-base-files-plus-typescript
Node 0.8 was released in June of 2012. It’s also the source of a lot of annoying warnings (and failures) in testing.
Perhaps it would help keep things simple to stick with Node ≥ 0.10 from now on.
Thoughts?
Hi,
I am trying to install gulp-replace-task with NPM for my project to be able to replace variables per environment. Unfortunately the installation of gulp-replace-task ends with an error. I have several other NPM packages installed correctly. Only the gulp-replace-task is failing for some reason.
I have tried to clean the cache (npm cache clean) and remove all node modules in the project, but this doesn't solve my issue unfortunately. I am running Windows 8.1. And I am an administrator on my laptop.
Here the output of NPM:
C:\Users\mark.veenstra\Documents\Project\mobilea-frontend>npm install gulp-repla
ce-task
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
npm WARN package.json [email protected] No description
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
npm WARN package.json [email protected] fs is also the name of a node core module.
npm WARN package.json [email protected] No description
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
\
> [email protected] preinstall C:\Users\mark.veenstra\Documents\Project\mobilea-fronten
d\node_modules\gulp-replace-task\node_modules\applause\node_modules\cson
> node ./cyclic.js
-
> [email protected] preinstall C:\Users\mark.veenstra\Documents\Project\mobilea-fronten
d\node_modules\gulp-replace-task\node_modules\applause\node_modules\cson\node_mo
dules\ambi
> node ./cyclic.js
|
> [email protected] preinstall C:\Users\mark.veenstra\Documents\Project\mobilea-fr
ontend\node_modules\gulp-replace-task\node_modules\applause\node_modules\cson\no
de_modules\js2coffee
> node ./cyclic.js
|
> [email protected] preinstall C:\Users\mark.veenstra\Documents\Project\mobilea-
frontend\node_modules\gulp-replace-task\node_modules\applause\node_modules\cson\
node_modules\extract-opts\node_modules\typechecker
> node ./cyclic.js
/
> [email protected] preinstall C:\Users\mark.veenstra\Documents\Project\mobilea-
frontend\node_modules\gulp-replace-task\node_modules\applause\node_modules\cson\
node_modules\ambi\node_modules\typechecker
> node ./cyclic.js
|
> [email protected] preinstall C:\Users\mark.veenstra\Documents\Project\mobilea-
frontend\node_modules\gulp-replace-task\node_modules\applause\node_modules\cson\
node_modules\js2coffee\node_modules\docpad\node_modules\typechecker
> node ./cyclic.js
> [email protected] preinstall C:\Users\mark.veenstra\Documents\Project\mobilea-front
end\node_modules\gulp-replace-task\node_modules\applause\node_modules\cson\node_
modules\js2coffee\node_modules\docpad\node_modules\safefs
> node ./cyclic.js
-
> [email protected] preinstall C:\Users\mark.veenstra\Documents\Project\mobilea-fron
tend\node_modules\gulp-replace-task\node_modules\applause\node_modules\cson\node
_modules\js2coffee\node_modules\docpad\node_modules\safeps
> node ./cyclic.js
\
> [email protected] preinstall C:\Users\mark.veenstra\Documents\Project\mobilea-fr
ontend\node_modules\gulp-replace-task\node_modules\applause\node_modules\cson\no
de_modules\js2coffee\node_modules\docpad\node_modules\safeps\node_modules\taskgr
oup
> node ./cyclic.js
|
> [email protected] preinstall C:\Users\mark.veenstra\Documents\Project\mobilea-fr
ontend\node_modules\gulp-replace-task\node_modules\applause\node_modules\cson\no
de_modules\js2coffee\node_modules\docpad\node_modules\watchr\node_modules\taskgr
oup
> node ./cyclic.js
/
> [email protected] preinstall C:\Users\mark.veenstra\Documents\Project\mobilea-fr
ontend\node_modules\gulp-replace-task\node_modules\applause\node_modules\cson\no
de_modules\js2coffee\node_modules\docpad\node_modules\bal-util\node_modules\task
group
> node ./cyclic.js
-
> [email protected] preinstall C:\Users\mark.veenstra\Documents\Project\mobilea-fronten
d\node_modules\gulp-replace-task\node_modules\applause\node_modules\cson\node_mo
dules\js2coffee\node_modules\docpad\node_modules\bal-util\node_modules\ambi
> node ./cyclic.js
|
> [email protected] preinstall C:\Users\mark.veenstra\Documents\Project\mobilea-fronten
d\node_modules\gulp-replace-task\node_modules\applause\node_modules\cson\node_mo
dules\js2coffee\node_modules\docpad\node_modules\watchr\node_modules\taskgroup\n
ode_modules\ambi
> node ./cyclic.js
\
> [email protected] preinstall C:\Users\mark.veenstra\Documents\Project\mobilea-fr
ontend\node_modules\gulp-replace-task\node_modules\applause\node_modules\cson\no
de_modules\js2coffee\node_modules\docpad\node_modules\taskgroup
> node ./cyclic.js
\
> [email protected] preinstall C:\Users\mark.veenstra\Documents\Project\mobilea-front
end\node_modules\gulp-replace-task\node_modules\applause\node_modules\cson\node_
modules\js2coffee\node_modules\docpad\node_modules\istextorbinary\node_modules\s
afefs
> node ./cyclic.js
-
> [email protected] preinstall C:\Users\mark.veenstra\Documents\Project\mobilea-fr
ontend\node_modules\gulp-replace-task\node_modules\applause\node_modules\cson\no
de_modules\js2coffee\node_modules\docpad\node_modules\istextorbinary\node_module
s\safefs\node_modules\taskgroup
> node ./cyclic.js
|
> [email protected] preinstall C:\Users\mark.veenstra\Documents\Project\mobilea-fronten
d\node_modules\gulp-replace-task\node_modules\applause\node_modules\cson\node_mo
dules\js2coffee\node_modules\docpad\node_modules\istextorbinary\node_modules\saf
efs\node_modules\taskgroup\node_modules\ambi
> node ./cyclic.js
npm ERR! [email protected] preinstall: `node ./cyclic.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] preinstall script.
npm ERR! This is most likely a problem with the ambi package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./cyclic.js
npm ERR! You can get their info via:
npm ERR! npm owner ls ambi
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "gulp-replace-task"
npm ERR! cwd C:\Users\mark.veenstra\Documents\Project\mobilea-frontend
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! syscall spawn
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! not ok code 0
See bevry/cson#68 and https://phabricator.babeljs.io/T6987 as to why
One option is to use babel's loose mode. Loose mode can be opted-in selectively:
{
"presets": ["es2015"],
"plugins": [
["transform-es2015-for-of", {
"loose": true
}]
]
}
All all-in:
Would need to go through already published modules and be more intelligent on how we've done loops now.
Might want to .gitignore .docpad.db
.
I'm sure there are many thoughts on this:
http://github.com/polarmobile/coffeescript-style-guide
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.