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

#97 add npm i test for windows #98

Merged
merged 7 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
21 changes: 20 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

strategy:
matrix:
os: [ubuntu-latest]
os: [ubuntu-latest, windows-latest]
node-version: [16.x]

steps:
Expand All @@ -29,3 +29,22 @@ jobs:
run: npm run build --if-present
- name: Run Tests
run: npm test --if-present

install:

runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [16.x]

steps:
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Init npm
run: npm init -y
- name: Install package
run: npm i @netcentric/fe-build
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"url": "https://github.com/Netcentric/fe-build.git "
},
"scripts": {
"preinstall": "mkdir -p .git && mkdir -p .git/hooks && cp ./hooks/pre-commit ./.git/hooks/pre-commit",
"clean": "rm -rf ./test/dist",
"contribute": "mkdir -p .git && mkdir -p .git/hooks && cp ./hooks/pre-commit ./.git/hooks/pre-commit",
"test": "npm run clean && jest --coverage=true"
},
"keywords": [
Expand Down
8 changes: 5 additions & 3 deletions utils/writeFile.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
const fs = require('fs');
const { log } = require('./log');
const path = require('path');

module.exports = function writeFile(filepath, content, override = false) {
const normalizePath = path.normalize(filepath);
// if is not set to not override
if (!override && fs.existsSync(filepath)) return;
if (!override && fs.existsSync(normalizePath)) return;

// white it
fs.writeFileSync(filepath, content,
fs.writeFileSync(normalizePath, content,
err => log(__filename, 'error', `could not write file: ${err.Error},'\n ${err.path}`, 'error'));

log(__filename, `write file...${filepath}`, '', 'info');
log(__filename, `write file...${normalizePath}`, '', 'info');
};
Loading