mirror of
https://github.com/actions/configure-pages.git
synced 2025-12-08 16:16:09 +00:00
add fixtures
This commit is contained in:
11
dist/index.js
vendored
11
dist/index.js
vendored
@@ -14542,6 +14542,10 @@ const espreeOptions = {
|
|||||||
|
|
||||||
class ConfigParser {
|
class ConfigParser {
|
||||||
constructor(staticSiteConfig) {
|
constructor(staticSiteConfig) {
|
||||||
|
this.pathPropertyNuxt = `router: {\n base: '{0}'\n }`
|
||||||
|
this.pathPropertyNext = `basePath: '{0}'`
|
||||||
|
this.pathPropertyGatsby = `pathPrefix: '{0}'`
|
||||||
|
this.configskeleton = `export default {\n {0}\n}`
|
||||||
this.staticSiteConfig = staticSiteConfig
|
this.staticSiteConfig = staticSiteConfig
|
||||||
this.config = fs.existsSync(this.staticSiteConfig.filePath) ? fs.readFileSync(this.staticSiteConfig.filePath, "utf8") : null
|
this.config = fs.existsSync(this.staticSiteConfig.filePath) ? fs.readFileSync(this.staticSiteConfig.filePath, "utf8") : null
|
||||||
this.validate()
|
this.validate()
|
||||||
@@ -14558,11 +14562,6 @@ class ConfigParser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pathPropertyNuxt = `router: {\n base: '{0}'\n }`
|
|
||||||
pathPropertyNext = `basePath: '{0}'`
|
|
||||||
pathPropertyGatsby = `pathPrefix: '{0}'`
|
|
||||||
configskeleton = `export default {\n {0}\n}`
|
|
||||||
|
|
||||||
generateConfigFile() {
|
generateConfigFile() {
|
||||||
switch (this.staticSiteConfig.type) {
|
switch (this.staticSiteConfig.type) {
|
||||||
case "nuxt":
|
case "nuxt":
|
||||||
@@ -14680,13 +14679,13 @@ class ConfigParser {
|
|||||||
parseNextGatsby(pathNode) {
|
parseNextGatsby(pathNode) {
|
||||||
if (pathNode) {
|
if (pathNode) {
|
||||||
console.log("base node = " + JSON.stringify(pathNode.value))
|
console.log("base node = " + JSON.stringify(pathNode.value))
|
||||||
|
|
||||||
const newConfig = this.config.slice(0, pathNode.value.range[0]) + `'${this.staticSiteConfig.newPath}'` + this.config.slice(pathNode.value.range[1])
|
const newConfig = this.config.slice(0, pathNode.value.range[0]) + `'${this.staticSiteConfig.newPath}'` + this.config.slice(pathNode.value.range[1])
|
||||||
console.log("new config = \n" + newConfig)
|
console.log("new config = \n" + newConfig)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 1319:
|
/***/ 1319:
|
||||||
|
|||||||
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
@@ -11,6 +11,10 @@ const espreeOptions = {
|
|||||||
|
|
||||||
class ConfigParser {
|
class ConfigParser {
|
||||||
constructor(staticSiteConfig) {
|
constructor(staticSiteConfig) {
|
||||||
|
this.pathPropertyNuxt = `router: {\n base: '{0}'\n }`
|
||||||
|
this.pathPropertyNext = `basePath: '{0}'`
|
||||||
|
this.pathPropertyGatsby = `pathPrefix: '{0}'`
|
||||||
|
this.configskeleton = `export default {\n {0}\n}`
|
||||||
this.staticSiteConfig = staticSiteConfig
|
this.staticSiteConfig = staticSiteConfig
|
||||||
this.config = fs.existsSync(this.staticSiteConfig.filePath) ? fs.readFileSync(this.staticSiteConfig.filePath, "utf8") : null
|
this.config = fs.existsSync(this.staticSiteConfig.filePath) ? fs.readFileSync(this.staticSiteConfig.filePath, "utf8") : null
|
||||||
this.validate()
|
this.validate()
|
||||||
@@ -27,11 +31,6 @@ class ConfigParser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pathPropertyNuxt = `router: {\n base: '{0}'\n }`
|
|
||||||
pathPropertyNext = `basePath: '{0}'`
|
|
||||||
pathPropertyGatsby = `pathPrefix: '{0}'`
|
|
||||||
configskeleton = `export default {\n {0}\n}`
|
|
||||||
|
|
||||||
generateConfigFile() {
|
generateConfigFile() {
|
||||||
switch (this.staticSiteConfig.type) {
|
switch (this.staticSiteConfig.type) {
|
||||||
case "nuxt":
|
case "nuxt":
|
||||||
@@ -149,7 +148,6 @@ class ConfigParser {
|
|||||||
parseNextGatsby(pathNode) {
|
parseNextGatsby(pathNode) {
|
||||||
if (pathNode) {
|
if (pathNode) {
|
||||||
console.log("base node = " + JSON.stringify(pathNode.value))
|
console.log("base node = " + JSON.stringify(pathNode.value))
|
||||||
|
|
||||||
const newConfig = this.config.slice(0, pathNode.value.range[0]) + `'${this.staticSiteConfig.newPath}'` + this.config.slice(pathNode.value.range[1])
|
const newConfig = this.config.slice(0, pathNode.value.range[0]) + `'${this.staticSiteConfig.newPath}'` + this.config.slice(pathNode.value.range[1])
|
||||||
console.log("new config = \n" + newConfig)
|
console.log("new config = \n" + newConfig)
|
||||||
}
|
}
|
||||||
|
|||||||
14
src/config-parser.test.js
Normal file
14
src/config-parser.test.js
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
const ConfigParser = require('./config-parser')
|
||||||
|
|
||||||
|
describe('configParser', () => {
|
||||||
|
it('set nextjs url correctly', async () => {
|
||||||
|
// parser = new ConfigParser({
|
||||||
|
// filePath:"./nuxt.config.js",
|
||||||
|
// type: "nuxt",
|
||||||
|
// pathName: "router",
|
||||||
|
// subPathName: "base",
|
||||||
|
// newPath: baseUrl
|
||||||
|
// })
|
||||||
|
// parser.generateConfigFile()
|
||||||
|
})
|
||||||
|
})
|
||||||
8
src/fixtures/gatsby-config.js
Normal file
8
src/fixtures/gatsby-config.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import { resolve } from 'path'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
alias: {
|
||||||
|
'style': resolve(__dirname, './assets/style')
|
||||||
|
},
|
||||||
|
pathPrefix: '/prefix',/* test */
|
||||||
|
}
|
||||||
3
src/fixtures/gatsby-config.old.js
Normal file
3
src/fixtures/gatsby-config.old.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
module.exports = {
|
||||||
|
pathPrefix: '/prefix'
|
||||||
|
}
|
||||||
9
src/fixtures/next.config.js
Normal file
9
src/fixtures/next.config.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
import { resolve } from 'path'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
alias: {
|
||||||
|
'style': resolve(__dirname, './assets/style')
|
||||||
|
},
|
||||||
|
basePath: '/gh-pages-test'/* test */,
|
||||||
|
}
|
||||||
4
src/fixtures/next.config.old.js
Normal file
4
src/fixtures/next.config.old.js
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
module.exports={
|
||||||
|
basePath: '/gh-pages-test'/* test */,
|
||||||
|
}
|
||||||
|
|
||||||
4
src/fixtures/next.config.old.missing.js
Normal file
4
src/fixtures/next.config.old.missing.js
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
module.exports={
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
11
src/fixtures/nuxt.config.js
Normal file
11
src/fixtures/nuxt.config.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import { resolve } from 'path'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
alias: {
|
||||||
|
'style': resolve(__dirname, './assets/style')
|
||||||
|
},
|
||||||
|
target: 'static',
|
||||||
|
router: {
|
||||||
|
base: 'some/path'
|
||||||
|
}
|
||||||
|
}
|
||||||
8
src/fixtures/nuxt.config.missing.js
Normal file
8
src/fixtures/nuxt.config.missing.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import { resolve } from 'path'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
alias: {
|
||||||
|
'style': resolve(__dirname, './assets/style')
|
||||||
|
},
|
||||||
|
target: 'static'
|
||||||
|
}
|
||||||
10
src/fixtures/nuxt.config.old.js
Normal file
10
src/fixtures/nuxt.config.old.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
module.exports={
|
||||||
|
alias: {
|
||||||
|
'style': resolve(__dirname, './assets/style')
|
||||||
|
},
|
||||||
|
target: 'static',
|
||||||
|
router: {
|
||||||
|
base: 'some/path'
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user