Skip to content

Commit

Permalink
refactor: move source files to dist/ folder
Browse files Browse the repository at this point in the history
BREAKING CHANGE: JavaScript files moved from project root into dist/ folder.
If you are defining a relative root path via --root option please prepend a ../ to it.
  • Loading branch information
saitho committed Mar 13, 2020
1 parent be2b900 commit a8fcfb8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion index.js → dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const path = require('path');
const colors = require('colors/safe');
const fs = require('fs');
const argv = require('yargs').argv;
let rootPath = path.join('..', '..', '..');
let rootPath = path.join('..', '..', '..', '..');
if (argv.hasOwnProperty('root')) {
rootPath = argv.root;
}
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"name": "@saithodev/ts-appversion",
"version": "1.3.0",
"description": "Reads the version from your packages.json and saves it in a .ts file you can include into your application.",
"main": "index.js",
"main": "dist/index.js",
"bin": {
"ts-appversion": "cli.js"
"ts-appversion": "dist/cli.js"
},
"scripts": {
"start": "node index.js",
"start": "node dist/index.js",
"test": "nyc --reporter=text --reporter=lcov mocha",
"snyk-protect": "snyk protect",
"prepare": "npm run snyk-protect",
Expand Down
1 change: 1 addition & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ sonar.links.ci=https://travis-ci.com/saitho/ng-appversion
sonar.links.scm=https://github.com/saitho/ng-appversion
sonar.links.issue=https://github.com/saitho/ng-appversion/issues

sonar.sources=dist
sonar.tests=test

sonar.javascript.lcov.reportPaths=coverage/lcov.info
10 changes: 5 additions & 5 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ before(function() {

describe('appversion', function() {
it('should skip when no package.json is found.', function(done) {
exec('node index.js --root=' + repoDir + ' --file=version-test.ts', (err, stdout, stderr) => {
exec('node dist/index.js --root=' + repoDir + ' --file=version-test.ts', (err, stdout, stderr) => {
if (err) {
done('Test failed: Could not execute command.');
return;
Expand All @@ -39,7 +39,7 @@ describe('appversion', function() {
it('should succeed with default settings and without a Git repository', function(done) {
fs.mkdirSync(path.join(repoDir, 'src'), {recursive: true});
fs.writeFileSync(path.join(repoDir, 'package.json'), '{"version": "1.0.0"}');
exec('node index.js --root=' + repoDir, (err, stdout, stderr) => {
exec('node dist/index.js --root=' + repoDir, (err, stdout, stderr) => {
if (err) {
done('Test failed: Could not execute command.');
return;
Expand All @@ -65,7 +65,7 @@ describe('appversion', function() {
repo.init();
fs.mkdirSync(path.join(repoDir, 'src'));
fs.writeFileSync(path.join(repoDir, 'package.json'), '{"version": "1.0.0"}');
exec('node index.js --root=' + repoDir, (err, stdout, stderr) => {
exec('node dist/index.js --root=' + repoDir, (err, stdout, stderr) => {
if (err) {
done('Test failed: Could not execute command.');
return;
Expand All @@ -92,7 +92,7 @@ describe('appversion', function() {
it('should succeed with different file output', function(done) {
repo.init();
fs.writeFileSync(path.join(repoDir, 'package.json'), '{"version": "1.0.0"}');
exec('node index.js --root=' + repoDir + ' --file=version-test.ts', (err, stdout, stderr) => {
exec('node dist/index.js --root=' + repoDir + ' --file=version-test.ts', (err, stdout, stderr) => {
if (err) {
done('Test failed: Could not execute command.');
return;
Expand Down Expand Up @@ -121,7 +121,7 @@ describe('appversion', function() {
fs.mkdirSync(applicationDir);
fs.mkdirSync(path.join(applicationDir, 'src'));
fs.writeFileSync(path.join(applicationDir, 'package.json'), '{"version": "1.0.0"}');
exec('node index.js --root=' + applicationDir + ' --git=..', (err, stdout, stderr) => {
exec('node dist/index.js --root=' + applicationDir + ' --git=..', (err, stdout, stderr) => {
if (err) {
done('Test failed: Could not execute command.');
return;
Expand Down

0 comments on commit a8fcfb8

Please sign in to comment.