Skip to content

Commit f22d706

Browse files
authored
Merge pull request #8 from Jake-Short/dev
Merge dev into main
2 parents a6c5e8a + 1970da3 commit f22d706

File tree

6 files changed

+22
-19
lines changed

6 files changed

+22
-19
lines changed

internal/generate.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,20 @@ function completionHandler(type, params) {
7878
console.log()
7979
console.log(`${chalk.bold('Inside that folder, you can run all NextJS commands, such as:')}`)
8080
console.log()
81-
console.log(chalk.cyan(` npm run dev`))
81+
console.log(chalk.cyan(` yarn dev`))
8282
console.log(' Starts the development server.')
8383
console.log()
84-
console.log(chalk.cyan(` npm run build`))
84+
console.log(chalk.cyan(` yarn build`))
8585
console.log(' Builds the app for production.')
8686
console.log()
87-
console.log(chalk.cyan(` npm run start`))
87+
console.log(chalk.cyan(` yarn start`))
8888
console.log(' Runs the built app in production mode.')
8989
console.log()
9090
console.log('You can begin by typing:')
9191
console.log()
9292
console.log(chalk.cyan(' cd') + ' site')
9393
console.log(
94-
` ${chalk.cyan(`npm install && npm run dev`)}`
94+
` ${chalk.cyan(`yarn && yarn dev`)}`
9595
)
9696
console.log()
9797
}

internal/info.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

internal/unavailable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ const chalk = require('chalk');
22

33
console.log()
44
console.log(`${chalk.red('Error: ')} This command is not available in development.`)
5-
console.log(`Run ${chalk.cyan('npm run generate')} and follow the instructions.`)
5+
console.log(`Run ${chalk.cyan('yarn generate')} and follow the instructions.`)
66
console.log()

internal/upgrade.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,22 @@ console.log(`${chalk.blue('Downloading repository...')}`);
1010
console.log('');
1111

1212
const internalDir = path.resolve(__dirname);
13+
const baseDir = path.resolve(__dirname, '..');
14+
15+
if(!fs.existsSync(internalDir + '/.temp')) {
16+
fs.mkdirSync(internalDir + '/.temp');
17+
}
1318
download('Jake-Short/nextjs-docs-generator#main', `${internalDir}/.temp`, (error) => {
1419
if(error) {
1520
console.log(`${chalk.red.bold('Error: ')} There was a problem downloading the repository. (${error})`);
1621
console.log(`Update aborted.`);
1722
console.log('');
1823
}
1924
else {
20-
let jsonData = JSON.parse(fs.readFileSync(`${internalDir}/.temp/internal/info.json`, 'utf-8'));
21-
let version = jsonData.version;
22-
let currVersion = JSON.parse(fs.readFileSync(`${internalDir}/info.json`, 'utf-8')).version;
25+
let version = JSON.parse(fs.readFileSync(`${internalDir}/.temp/package.json`, 'utf-8')).version;
26+
27+
let currPackageContents = JSON.parse(fs.readFileSync(`${baseDir}/package.json`, 'utf-8'));
28+
let currVersion = JSON.parse(fs.readFileSync(`${baseDir}/package.json`, 'utf-8')).version;
2329

2430
if(currVersion === version) {
2531
console.log('');
@@ -71,11 +77,11 @@ download('Jake-Short/nextjs-docs-generator#main', `${internalDir}/.temp`, (error
7177
if(res.Continue === true) {
7278
// Trigger update
7379
if(res.Continue === true) {
74-
const baseDir = path.resolve(__dirname, '..');
75-
76-
if(!fs.existsSync(internalDir + '/.temp')) {
77-
fs.mkdirSync(internalDir + '/.temp');
78-
}
80+
// Update package.json version to new version
81+
currPackageContents.version = version;
82+
83+
// Write new package.json into site folder
84+
fs.writeFileSync(baseDir + '/package.json', JSON.stringify(currPackageContents, null, 4));
7985

8086
// Copy selected folders below
8187
if(foldersToUpdate.includes('internal')) {

internal/version.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ const chalk = require('chalk');
22
const fs = require('fs');
33
const path = require('path');
44

5-
const internalDir = path.resolve(__dirname);
5+
const baseDir = path.resolve(__dirname, '..');
66

7-
let currVersion = JSON.parse(fs.readFileSync(`${internalDir}/info.json`, 'utf-8')).version;
7+
let currVersion = JSON.parse(fs.readFileSync(`${baseDir}/package.json`, 'utf-8')).version;
88

99
console.log('');
1010
console.log(`You are on version ${chalk.cyan.bold(currVersion)}.`);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nextjs-docs-generator",
3-
"version": "0.1.0",
3+
"version": "1.0.0",
44
"private": true,
55
"scripts": {
66
"dev": "node internal/runtimeserver.js",

0 commit comments

Comments
 (0)