yoshuawuyts / copy-template-dir Goto Github PK
View Code? Open in Web Editor NEWHigh throughput template dir writes
License: MIT License
High throughput template dir writes
License: MIT License
I'd love to be able to write my template files in ejs and just run it through copy-template-dir - what do you think of adding a little transform callback for this?
Would it be possible to extend renaming of _
prefixed files to include all files with the prefix, not just dotfiles?
I just discovered that npm will read nested package.json files in your project, which caused this packaging issue with some templates I was providing: insin/nwb#21
To avoid this, I would need to rename package.json
files which will be copied by copy-template-dir to _package.json
.
I can create a PR for this later if you're ok with the proposed change.
I have a template directory with a tests/_.eslintrc
file which isn't getting renamed by reDot
.
This tweak seems to do the trick:
function reDot (filepath) {
const parts = filepath.split(path.sep)
const filename = parts.pop().replace(/^\_./, '.')
return parts.concat([filename]).join(path.sep)
}
Just something which came up today using [email protected]:
I moved some code up a directory and forgot to change the relative path it was using to find my template directory, but I didn't get an error callback from copy-template-dir due to the non-existent directory.
It seems like copy-template-dir is eating errors from readdirp
because it's using the streaming interface and there's no .on('error' ...)
handler.
What's your preferred solution to this?
copyTemplateDir
and bail out early.readdirp
stream (it seems it attempts 2 file operations before returning the stream - I saw 2 errors when I tried this quickly in my node_modules/copy-template-dir
)There is a .github file as follow I want copy it to another dir.
name: github pages
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v2.1.0
with:
node-version: '12.x'
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-website-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-website-
- run: yarn install --frozen-lockfile
- run: yarn build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: .crd-dist
But when use copy-template-dir, the output file is converted to
name: github pages
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v2.1.0
with:
node-version: '12.x'
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: $
key: $-website-$
restore-keys: |
$-website-
- run: yarn install --frozen-lockfile
- run: yarn build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: $
publish_dir: .crd-dist
Is there any hook to use custom syntax to achieve variable injection to avoid such situation.
I think, It's much better to use Promise instead of callback.
like this:
copy(inDir, outDir, vars).then(() => {
console.log('done');
}).catch(err => { throw err; });
And I'm interested in to do that.
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.