Skip to content

Commit

Permalink
Remove NodeJS builds (#119).
Browse files Browse the repository at this point in the history
  • Loading branch information
jimafisk committed Mar 22, 2021
1 parent 3f98b63 commit 01891d1
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 437 deletions.
40 changes: 9 additions & 31 deletions cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ var VerboseFlag bool
// BenchmarkFlag provides users with build speed statistics to help identify bottlenecks.
var BenchmarkFlag bool

// NodeJSFlag let you use your systems NodeJS to build the site instead of core build.
var NodeJSFlag bool

func setBuildDir(siteConfig readers.SiteConfig) string {
buildDir := siteConfig.BuildDir
// Check if directory is overridden by flag.
Expand Down Expand Up @@ -127,34 +124,16 @@ func Build() error {
return err
}

// Run the build.js script using user local NodeJS.
if NodeJSFlag {
clientBuildStr, err := build.NodeClient(buildPath)
if err = common.CheckErr(err); err != nil {
return err
}
staticBuildStr, allNodesStr, err := build.NodeDataSource(buildPath, siteConfig)
if err = common.CheckErr(err); err != nil {
return err
}

if err = common.CheckErr(build.NodeExec(clientBuildStr, staticBuildStr, allNodesStr)); err != nil {
return err
}
} else {

// Prep the client SPA.
err = build.Client(buildPath, tempBuildDir, defaultsEjectedFS)
if err = common.CheckErr(err); err != nil {
return err
}

// Build JSON from "content/" directory.
err = build.DataSource(buildPath, siteConfig, tempBuildDir)
if err = common.CheckErr(err); err != nil {
return err
}
// Prep the client SPA.
err = build.Client(buildPath, tempBuildDir, defaultsEjectedFS)
if err = common.CheckErr(err); err != nil {
return err
}

// Build JSON from "content/" directory.
err = build.DataSource(buildPath, siteConfig, tempBuildDir)
if err = common.CheckErr(err); err != nil {
return err
}

// Run Gopack (custom Snowpack alternative) for ESM support.
Expand Down Expand Up @@ -189,5 +168,4 @@ func init() {
buildCmd.Flags().StringVarP(&BuildDirFlag, "dir", "d", "", "change name of the build directory")
buildCmd.Flags().BoolVarP(&VerboseFlag, "verbose", "v", false, "show log messages")
buildCmd.Flags().BoolVarP(&BenchmarkFlag, "benchmark", "b", false, "display build time statistics")
buildCmd.Flags().BoolVarP(&NodeJSFlag, "nodejs", "n", false, "use system nodejs for build with ejectable build.js script")
}
13 changes: 1 addition & 12 deletions cmd/build/eject_copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,8 @@ func EjectCopy(buildPath string, tempBuildDir string, defaultsEjectedFS embed.FS
if err != nil {
return fmt.Errorf("can't stat %s: %w", ejectPath, err)
}
// Make list of files not to copy to build.
excludedFiles := []string{
"ejected/build.js",
}
// Check if the current file is in the excluded list.
excluded := false
for _, excludedFile := range excludedFiles {
if excludedFile == ejectPath {
excluded = true
}
}
// If the file is already in .js format just copy it straight over to build dir.
if filepath.Ext(ejectPath) == ".js" && !excluded {
if filepath.Ext(ejectPath) == ".js" {

destPath := buildPath + "/spa/"
if err := os.MkdirAll(destPath+strings.TrimPrefix("ejected", tempBuildDir), os.ModePerm); err != nil {
Expand Down
74 changes: 0 additions & 74 deletions cmd/build/node_client.go

This file was deleted.

197 changes: 0 additions & 197 deletions cmd/build/node_data_source.go

This file was deleted.

19 changes: 0 additions & 19 deletions cmd/build/node_exec.go

This file was deleted.

Loading

0 comments on commit 01891d1

Please sign in to comment.